import time
from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
#打开浏览器
driver =webdriver.Chrome()
driver.get('https://www.baidu.com/')
#请求百度
kw=driver.find_element(By.ID,'kw')
#输入天气预报
kw.send_keys('天气预报')
#全选复制关键字
time.sleep(3)
kw.send_keys(Keys.CONTROL,'a')
time.sleep(3)
kw.send_keys(Keys.CONTROL,'c')
#请求so
driver.get('https://www.so.com/')
#定位搜索框
iput=driver.find_element(By.ID,'input')
#粘贴
iput.send_keys(Keys.CONTROL,'v')
#点击搜索按钮
driver.find_element(By.ID,"search-button").click()
#退出浏览器
driver.quit()